package cn.org.rookie.jeesdp.authentication;

import cn.org.rookie.jeesdp.core.utils.AESUtils;
import org.springframework.security.crypto.password.PasswordEncoder;

public class JeesdpPasswordEncoder implements PasswordEncoder {
    @Override
    public String encode(CharSequence rawPassword) {
        return AESUtils.encrypt(rawPassword.toString());
    }

    @Override
    public boolean matches(CharSequence rawPassword, String encodedPassword) {
        return rawPassword.toString().equals(AESUtils.decrypt(encodedPassword));
    }
}
